home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1999 January / PC Plus Super CD No55a (PCP-147A-1-99) (Disc 1) (1998).iso / linux / developers / visualtcl / windows / vtcl / lib / vtclib.tcl < prev    next >
Encoding:
Text File  |  1997-05-04  |  2.0 KB  |  55 lines

  1. ##############################################################################
  2. # $Id: vtclib.tcl,v 1.5 1997/05/05 03:49:20 stewart Exp $
  3. #
  4. # vtclib.tcl - procedures shared by Visual Tcl and apps it generates
  5. #
  6. # Copyright (C) 1996-1997 Stewart Allen
  7. #
  8. # This program is free software; you can redistribute it and/or
  9. # modify it under the terms of the GNU General Public License
  10. # as published by the Free Software Foundation; either version 2
  11. # of the License, or (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program; if not, write to the Free Software
  20. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  
  22. ##############################################################################
  23. #
  24.  
  25. proc Window {args} {
  26.     global vTcl
  27.     set cmd [lindex $args 0]
  28.     set name [lindex $args 1]
  29.     set newname [lindex $args 2]
  30.     set rest [lrange $args 3 end]
  31.     if {$name == "" || $cmd == ""} {return}
  32.     if {$newname == ""} {
  33.         set newname $name
  34.     }
  35.     set exists [winfo exists $newname]
  36.     switch $cmd {
  37.         show {
  38.             if {$exists == "1" && $name != "."} {wm deiconify $name; return}
  39.             if {[info procs vTclWindow(pre)$name] != ""} {
  40.                 eval "vTclWindow(pre)$name $newname $rest"
  41.             }
  42.             if {[info procs vTclWindow$name] != ""} {
  43.                 eval "vTclWindow$name $newname $rest"
  44.             }
  45.             if {[info procs vTclWindow(post)$name] != ""} {
  46.                 eval "vTclWindow(post)$name $newname $rest"
  47.             }
  48.         }
  49.         hide    { if $exists {wm withdraw $newname; return} }
  50.         iconify { if $exists {wm iconify $newname; return} }
  51.         destroy { if $exists {destroy $newname; return} }
  52.     }
  53. }
  54.  
  55.